From b5e00d36f084b827c48e4c9b8adc8fcedc14f2ff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 6 Sep 2017 08:33:18 -0400 Subject: [PATCH] Allow building without tests and demos This is meant to cut down build time in flatpak and similar situations. Since it produces technically incomplete builds, we list these options in the status output at the end of the meson run. --- docs/reference/gtk/building.sgml | 24 ++++++++++++++++++------ meson.build | 16 +++++++++++----- meson_options.txt | 4 ++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml index 2f2dc1bb78..51e5d8e8f5 100644 --- a/docs/reference/gtk/building.sgml +++ b/docs/reference/gtk/building.sgml @@ -462,12 +462,12 @@ How to compile GTK+ itself - <systemitem>-Denable-x11-backend</systemitem>, - <systemitem>-Denable-win32-backend</systemitem>, - <systemitem>-Denable-quartz-backend</systemitem>, - <systemitem>-Denable-broadway-backend</systemitem>, - <systemitem>-Denable-wayland-backend</systemitem>, and - <systemitem>-Denable-mir-backend</systemitem> + <systemitem>enable-x11-backend</systemitem>, + <systemitem>enable-win32-backend</systemitem>, + <systemitem>enable-quartz-backend</systemitem>, + <systemitem>enable-broadway-backend</systemitem>, + <systemitem>enable-wayland-backend</systemitem>, and + <systemitem>enable-mir-backend</systemitem> Enable specific backends for GDK. If none of these options @@ -480,6 +480,18 @@ How to compile GTK+ itself + + <systemitem>build-tests</systemitem> + <systemitem>demos</systemitem> + + + By default, GTK+ will build quite a few tests and demos. + While these are useful on a developer system, they are not + needed when GTK+ is built e.g. for a flatpak runtime. These + options allow to disable building tests and demos. + + + diff --git a/meson.build b/meson.build index 995680aa90..85f408cb7e 100644 --- a/meson.build +++ b/meson.build @@ -520,11 +520,15 @@ subdir('modules/input') subdir('gdk') subdir('gsk') subdir('gtk') -subdir('demos') subdir('modules') -subdir('tests') -subdir('testsuite') -subdir('examples') +if get_option('enable-tests') + subdir('tests') + subdir('testsuite') +endif +if get_option('demos') + subdir('demos') + subdir('examples') +endif # config.h configure_file(input: 'config.h.meson', @@ -615,8 +619,10 @@ summary = [ 'GTK+ @0@ (@1@)'.format(gtk_version, gtk_api_version), '', ' Enabled backends: @0@'.format(pkg_targets.strip()), - ' Documentation: @0@'.format(get_option('enable-documentation')), ' Vulkan support: @0@'.format(have_vulkan), + ' Tests: @0@'.format(get_option('build-tests')), + ' Documentation: @0@'.format(get_option('enable-documentation')), + ' Demos: @0@'.format(get_option('demos')), '------', '' ] diff --git a/meson_options.txt b/meson_options.txt index 586ad3e884..f3b587a212 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -36,3 +36,7 @@ option('enable-man-pages', type: 'boolean', value: 'false', description : 'Build man pages for installed tools') option('enable-gir', type: 'boolean', value: 'true', description : 'Build introspection data (requires gobject-introspection)') +option('demos', type: 'boolean', value: 'true', + description : 'Build demos and example programs') +option('build-tests', type: 'boolean', value: 'true', + description : 'Build tests') -- 2.30.2